<?php

class TypeProprieteDAO extends DAO{


	function getById($id){

		try
		{
			$id = Validator::escapeSql($id);
			$query="select * from TYPE_PROPRIETE where id=$id;";
			$statement=$this->pdo->query($query);
			$array_obj=$statement->fetchAll(PDO::FETCH_OBJ);
			$thebean = null;
			foreach($array_obj as $Bean){
				$thebean = new TypePropriete((int)$Bean->ID);
				$thebean->setLabel($Bean->LABEL);
				$thebean->setComment($Bean->COMMENT);
			}
		}
		catch(Exception $e)     {
			throw $e;
		}

		return $thebean;
	}

	function All(){
		try
		{
			$BeanArray = array();
			$query="select * from TYPE_PROPRIETE;";
			$statement=$this->pdo->query($query);
			$array_obj=$statement->fetchAll(PDO::FETCH_OBJ);
			$thebean = null;
			foreach($array_obj as $Bean){
				$thebean = $this->getById((int)$Bean->ID);
				array_push($BeanArray,$thebean);
			}
		}
		catch(Exception $e)     {
			throw $e;
		}

		return $BeanArray;

	}
}
?>